const { createProxyMiddleware: proxy } = require("http-proxy-middleware");

module.exports = (app) => {
    app.use(
        process.env.REACT_APP_BASE_URL,
        proxy({
            // 此处的端口号要与后期数据请求的数据端一致
            target: "http://localhost:9090",
            changeOrigin: true,
            pathRewrite: { '^/api': '/' }
        })
    );
    app.use(
        "/wt",
        proxy({
            // 此处的端口号要与后期数据请求的数据端一致
            target: " http://jwxae7.natappfree.cc",
            changeOrigin: true,
            pathRewrite: { '^/wt': '/' }
        })
    );
    app.use(
        '/wfl',
        proxy({
            target: " http://8db727.natappfree.cc",
            changeOrigin: true,
            pathRewrite: { '^/wfl': '/' }
        })
    );
    app.use(
        '/xfy',
        proxy({
            target: "http://9xtqgp.natappfree.cc",
            changeOrigin: true,
            pathRewrite: { '^/xfy': '/' }
        })
    );
    app.use(
        "/lxq",
        proxy({
            // 此处的端口号要与后期数据请求的数据端一致
            target: " http://2dvj2n.natappfree.cc",
            changeOrigin: true,
            pathRewrite: { '^/lxq': '/' }
        })
    );
    app.use(
        "/zcx",
        proxy({
            target: "http://rdccu7.natappfree.cc",
            changeOrigin: true,
            pathRewrite: { '^/zcx': '/' }
        })
    );
    app.use(
        "/cxy",
        proxy({
            target: "http://5kts8u.natappfree.cc ",
            changeOrigin: true,
            pathRewrite: { '^/cxy': '/' }
        })
    );
};
